const { defineConfig } = require('@vue/cli-service')
const { VantResolver } = require('unplugin-vue-components/resolvers');
const ComponentsPlugin = require('unplugin-vue-components/webpack');
module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack: {
    plugins: [
      ComponentsPlugin({
        resolvers: [VantResolver()],
      }),
    ],
  },
  devServer: {
    host: 'localhost',
    port: 8080,
    https: false,
    // 以上的ip和端口是我们本机的，下面为需要跨域的
    proxy: {  // 配置跨域
      '/api': {
        target: 'http://localhost:8083',  //这是后台的地址模拟的
        ws: true,
        changOrigin: true,  // 允许跨域
        pathRewrite: {
          '^/api': 'http://localhost:8083' // 请求的时候使用这个
        }
      }
    }
  }
})
